
//
//  BattlefieldHeaderView.m
//  LookScore
//
//  Created by wws on 2018/1/18.
//  Copyright © 2018年 ChongQingXunTiCompany. All rights reserved.
//


#import "BattlefieldHeaderView.h"
#import "LSTopicCircleDetailModel.h"
@implementation BattlefieldHeaderView{
    
    UIImageView * _battlefieldImageView;
    UILabel * _topTitleLable;
    UILabel * _topicNumberLable;
    UILabel * _desTextLable;
    
}

-(instancetype)initWithFrame:(CGRect)frame{
    self=[super initWithFrame:frame];
    if (self) {
        [self addHeaderSubviews];
    }
    return self;
}

/*加入子视图*/
-(void)addHeaderSubviews{
   
    //绿荫沙场图片
    NSInteger topLeftPadding=10;
    UIImageView *battlefieldImageView = [[UIImageView alloc] init];
    
    [self addSubview:battlefieldImageView];
    _battlefieldImageView = battlefieldImageView;
        battlefieldImageView.sd_layout.leftSpaceToView(self, topLeftPadding).topEqualToView(self).offset(topLeftPadding).widthIs(LSScreenWidth*0.27).heightIs(56);
    
    //文本
    UILabel *topTitleLable=[[UILabel alloc]init];
    topTitleLable.font=LSFontSize13;
//    topTitleLable.text=@"绿茵沙场";
    topTitleLable.textColor=[[UIColor blackColor]colorWithAlphaComponent:0.8];
    topTitleLable.textAlignment=NSTextAlignmentLeft;
    [self addSubview:topTitleLable];
    _topTitleLable = topTitleLable;
    topTitleLable.sd_layout.leftSpaceToView(battlefieldImageView, 5).topEqualToView(battlefieldImageView).heightIs(15).widthRatioToView(battlefieldImageView, 0.8);
    
    //话题参与数
    UILabel *topicNumberLable=[[UILabel alloc]init];
    topicNumberLable.font=LSFontSize12;
//    topicNumberLable.text=@"话题 1003";
    topicNumberLable.textColor=LSTitleGrayColor2;
    topicNumberLable.textAlignment=NSTextAlignmentLeft;
    [self addSubview:topicNumberLable];
    _topicNumberLable = topicNumberLable; topicNumberLable.sd_layout.leftEqualToView(topTitleLable).topSpaceToView(topTitleLable, 0).heightIs(15).rightSpaceToView(self, 10);
    
    //附加描述
    UILabel *desTextLable=[[UILabel alloc]init];
    desTextLable.font=LSFontSize12;
//    desTextLable.text=@"每天有话题,精彩每一天";
    desTextLable.textAlignment=NSTextAlignmentLeft;
    desTextLable.textColor=LSTitleGrayColor2;
    [self addSubview:desTextLable];
    _desTextLable = desTextLable; desTextLable.sd_layout.leftEqualToView(topicNumberLable).bottomEqualToView(battlefieldImageView).rightSpaceToView(self, 10).heightIs(15);
    
    //灰色的底线
    UIView  *lineView=[[UIView alloc]init];
    lineView.backgroundColor=LSBackGroundColor;
    [self addSubview:lineView];
    lineView.sd_layout.leftSpaceToView(self, 0).rightEqualToView(self).heightIs(8).topSpaceToView(battlefieldImageView,topLeftPadding);
}


- (void)setModel:(LSTopicCircleDetailModel *)model{
    _model = model;
    _desTextLable.text = model.SpecialWords;
    [_battlefieldImageView sd_setImageWithURL:[NSURL URLWithString:model.ImageUrl] placeholderImage:nil];
    _topTitleLable.text = model.Name;
    _topicNumberLable.text = model.TopicCount;
    
}

@end


@implementation IssueTopicButton

- (CGRect)imageRectForContentRect:(CGRect)bounds{
    
    return CGRectMake(0.0, 0.0, self.size.width, self.size.height);
}
@end

